home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / async.zip / ASYNC.C < prev    next >
C/C++ Source or Header  |  1986-10-21  |  956b  |  52 lines

  1.  
  2. static char buf[128];
  3. extern unsigned long old_vector;
  4. int portnum;
  5. main(argc,argv)
  6. char **argv;
  7. {
  8. #ifdef DEBUG
  9. here: goto here;
  10. #endif
  11.     if (argc == 1)
  12.     {
  13.         write(2,"async : usage async [0|1]\r\n",27);
  14.         exit(1);
  15.     }
  16.     portnum = atoi(argv[1]);
  17.     async_init(portnum);
  18.     setup_int14();
  19.     terminate();
  20. }
  21.  
  22. c_handler(ax,bx,cx,dx,si,di,ds,es)
  23. unsigned ax,bx,cx,dx,si,di,ds,es;
  24. {
  25.     /* if not our port, call the rom to find the stuff out */
  26.     if (portnum != dx)
  27.     {
  28.         ax = call_rom(ax,dx);
  29.         return;
  30.     }
  31.     switch(ax >> 8)    /* pick up function number */
  32.     {
  33.     case 0:    /* setup */
  34.         async_restore();    /* they don't work properly if you change parms */
  35.         call_rom(ax,dx);    /* do setup */
  36.         async_init(portnum);
  37.         break;
  38.     case 1:
  39.         async_putc(ax & 0xFF);
  40.         break;
  41.     case 2:
  42.         ax = (unsigned)(async_getc() & 0xFF);
  43.         break;
  44.     case 3:
  45.         ax = call_rom(ax,dx);
  46.         if (async_status())
  47.             ax |= 0x0100;
  48.         else
  49.             ax &= 0xFEFF;
  50.         break;
  51.     }
  52. }